Skip to content

Take the named-member overloads a migration writes - #43

Merged
Veneury merged 1 commit into
mainfrom
feature/named-members
Sep 29, 2026
Merged

Veneury merged 1 commit into
mainfrom
feature/named-members

Conversation

@Veneury

@Veneury Veneury commented Sep 29, 2026

Copy link
Copy Markdown
Owner

ForMember by name, MapFrom by name, ForAllMembers, and ForSourceMember with DoNotValidate. They exist because the library this one is a drop-in for has them and a configuration that chooses a member somewhere a lambda cannot reach had to be rewritten by hand. All four were run side by side against AutoMapper and answer the same.

A dotted name walks a path, the shape the expression overloads already took, and it is resolved while the configuration is built rather than when a map runs: a misspelling is a configuration error instead of a member that quietly maps to nothing. The expression overloads stay the ones to prefer, since they keep the compiler involved, and the documentation says so.

The analyser learned the string form as well, so a member named as text is still tracked by the checks that say two calls disagree about it.

The rest of the surface comparison is deliberately not here. Copying the overload list wholesale would break source compatibility: over there the extra PreCondition overloads make o.PreCondition(s => false) ambiguous, and that call compiles here today.

ForMember by name, MapFrom by name, ForAllMembers, and ForSourceMember with
DoNotValidate. They exist because the library this one is a drop-in for has them
and a configuration that chooses a member somewhere a lambda cannot reach had to
be rewritten by hand. All four were run side by side against AutoMapper and
answer the same.

A dotted name walks a path, the shape the expression overloads already took, and
it is resolved while the configuration is built rather than when a map runs: a
misspelling is a configuration error instead of a member that quietly maps to
nothing. The expression overloads stay the ones to prefer, since they keep the
compiler involved, and the documentation says so.

The analyser learned the string form as well, so a member named as text is still
tracked by the checks that say two calls disagree about it.

The rest of the surface comparison is deliberately not here. Copying the
overload list wholesale would break source compatibility: over there the extra
PreCondition overloads make o.PreCondition(s => false) ambiguous, and that call
compiles here today.
@Veneury
Veneury merged commit 5c26189 into main Sep 29, 2026
7 checks passed
@Veneury
Veneury deleted the feature/named-members branch September 29, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant